package cate.game.train.inscription.msg;


import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTrain;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "铭文装配到铭文页 的 请求")
@OperationSetter(GDOperation.INSCRIPTION_ON)
public class InscriptionOnReq implements MsgInput {

    @NoteField("铭文唯一id")
    public String inscriptionUid;
    @NoteField("铭文页id")
    public int id;
    @NoteField("铭文页格子")
    public byte pos;

    @Override
    public MsgConfig conf() {
        return MsgIdBTrain.INSCRIPTION_ON_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Byte> r = game.train.inscription.inscriptionOn(cc.getRole(), inscriptionUid, id, pos);
        if (!r.ok()) {
            cc.getRole().getGame().notice.message(cc.getRole(), r);
        }
    }
}
